package com.ruoyi.web.controller.admin;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.HospitalSubscribeInspectionResults;
import com.ruoyi.system.service.IHospitalSubscribeInspectionResultsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 检查项目结果Controller
 * 
 * @author ruoyi
 * @date 2025-05-26
 */
@RestController
@RequestMapping("/admin/results")
public class HospitalSubscribeInspectionResultsAdminController extends BaseController
{
    @Autowired
    private IHospitalSubscribeInspectionResultsService hospitalSubscribeInspectionResultsService;

    /**
     * 查询检查项目结果列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HospitalSubscribeInspectionResults hospitalSubscribeInspectionResults)
    {
        startPage();
        List<HospitalSubscribeInspectionResults> list = hospitalSubscribeInspectionResultsService.selectHospitalSubscribeInspectionResultsList(hospitalSubscribeInspectionResults);
        return getDataTable(list);
    }

    /**
     * 导出检查项目结果列表
     */
    @Log(title = "检查项目结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HospitalSubscribeInspectionResults hospitalSubscribeInspectionResults)
    {
        List<HospitalSubscribeInspectionResults> list = hospitalSubscribeInspectionResultsService.selectHospitalSubscribeInspectionResultsList(hospitalSubscribeInspectionResults);
        ExcelUtil<HospitalSubscribeInspectionResults> util = new ExcelUtil<HospitalSubscribeInspectionResults>(HospitalSubscribeInspectionResults.class);
        util.exportExcel(response, list, "检查项目结果数据");
    }

    /**
     * 获取检查项目结果详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(hospitalSubscribeInspectionResultsService.selectHospitalSubscribeInspectionResultsById(id));
    }

    /**
     * 新增检查项目结果
     */
    @Log(title = "检查项目结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HospitalSubscribeInspectionResults hospitalSubscribeInspectionResults)
    {
        return toAjax(hospitalSubscribeInspectionResultsService.insertHospitalSubscribeInspectionResultsList(hospitalSubscribeInspectionResults.getHospitalSubscribeInspectionResults()));
    }

    /**
     * 修改检查项目结果
     */
    @Log(title = "检查项目结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HospitalSubscribeInspectionResults hospitalSubscribeInspectionResults)
    {
        return toAjax(hospitalSubscribeInspectionResultsService.updateHospitalSubscribeInspectionResults(hospitalSubscribeInspectionResults));
    }

    /**
     * 删除检查项目结果
     */
    @Log(title = "检查项目结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(hospitalSubscribeInspectionResultsService.deleteHospitalSubscribeInspectionResultsByIds(ids));
    }
}
